label: Skip updating link state if we have no layout
authorTimm Bäder <mail@baedert.org>
Fri, 11 Jan 2019 16:46:12 +0000 (17:46 +0100)
committerTimm Bäder <mail@baedert.org>
Fri, 11 Jan 2019 16:46:12 +0000 (17:46 +0100)
This can happen whenever the ::activate-link handler sets different
markup on the label, causing all links to be recreated. In this case,
the GtkLabelLink* passed to emit_activate_link is garbage after the
g_signal_emit call and we shouldn't try to do anything with it.

Fixes #1498

gtk/gtklabel.c

index 7ca9ad7cf329c734848ba60d5bc5931a20cc531d..1d4223aada325f097ca85dd6a64f224d229e5638 100644 (file)
@@ -6173,6 +6173,11 @@ emit_activate_link (GtkLabel     *label,
   GtkStateFlags state;
 
   g_signal_emit (label, signals[ACTIVATE_LINK], 0, link->uri, &handled);
+
+  /* signal handler might have invalidated the layout */
+  if (!priv->layout)
+    return;
+
   if (handled && priv->track_links && !link->visited &&
       priv->select_info && priv->select_info->links)
     {